﻿@page "/demos/events"
@inherits EventsComponent
@layout DemoLayout
@inject LayoutData LayoutData

@code {
    protected override void OnInitialized()
    {
        base.OnInitialized();

        LayoutData.Title = "Events";
        LayoutData.Info = "The current available events are: NodeAdded, NodeRemoved, SelectionChanged, LinkAdded, LinkAttached and LinkRemoved.<br />" +
                "Also, the Diagram and every Model have a Changed event.";
        LayoutData.DataChanged();
    }
}

<div style="height: 500px">
    <CascadingValue Value="BlazorDiagram">
        <DiagramCanvas></DiagramCanvas>
    </CascadingValue>
</div>
<h2 class="ml-3">
    Events
    <button class="btn btn-sm text-danger" @onclick="() => events.Clear()"><i class="fas fa-trash"></i></button>
</h2>
<div class="mx-2" style="max-height: 300px; overflow: auto;">
    @foreach (var e in events)
    {
        <div class="m-3">
            @e
        </div>
    }
</div>
